package com.tfswue.qiu;

import com.tfswue.qiu.config.Myconfig;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.cloud.loadbalancer.annotation.LoadBalancerClients;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

//开启远程调用
@EnableFeignClients

//扫描Mapper的路径
@MapperScan("com.tfswue.qiu.mapper")
@LoadBalancerClients(defaultConfiguration = {Myconfig.class})
@SpringBootApplication
public class OrderApplication {
    public static void main(String[] args) {
        SpringApplication.run(OrderApplication.class, args);
    }

    //发送http请求，用于调用用户服务
    //RestTemplate是Spring提供的用于访问Rest服务的客户端模板类，作用于底层HTTP请求
    @Bean
    @LoadBalanced
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}
